﻿@model Kunlun.Models.Address
@{
	ViewBag.Title = "新增地址";
}
@section Head{
	<link href="@Url.Content("~/Content/member/style.css")" rel="stylesheet" type="text/css" />
	<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
	<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
	<script>
		$(document).ready(function () {
			$("#Pid").change(function () { getCity(this.value) }),
        $("#Cid").change(function () { getArea(this.value) })
		});
		function getCity(id) {
			$.get("/Select/SelectCity/" + id, function (data) {
				$("#Cid").empty();

				$("#Cid").append($("#<option></option>").val("").html("选择市县"))
				for (i = 0; i < data.length; i++) {
					$("#Cid").append($("#<option></option>").val(data[i].cityID).html(data[i].cityName))
				}
			})
		}
		function getArea(id) {
			$.get("/Select/SelectArea/" + id, function (data) {
				$("#Areas").empty();
				$("#Areas").append($("#<option></option>").val("").html("请选择区"))
				for (i = 0; i < data.length; i++) {
					$("#Areas").append($("#<option></option>").val(data[i].areaID).html(data[i].areaName));
				}
			})
		}
	</script>
}
<div id="content">
	@Html.Partial("_MymenuPartial")
	
	@using (Html.BeginForm()) {
		@Html.ValidationSummary(true)
		<fieldset class="right">
			<legend>地址簿</legend>
			<dl>
				<dt>
					@Html.LabelFor(model => model.Pid)</dt>
				<dd>
					@Html.DropDownList("Pid", "选择省份") @Html.DropDownList("Cid") @Html.DropDownList("Areas")</dd>
				<dd class="error">
					@Html.ValidationMessageFor(model => model.Pid)@Html.ValidationMessageFor(model => model.Cid)
					@Html.ValidationMessageFor(model => model.Areas)</dd>
			</dl>
			<dl>
				<dt>
					@Html.LabelFor(model => model.LinkMan)</dt>
				<dd>
					@Html.EditorFor(model => model.LinkMan)</dd>
				<dd class="error">@Html.ValidationMessageFor(model => model.LinkMan)</dd>
			</dl>
			<dl>
				<dt>
					@Html.LabelFor(model => model.AddressPlace)</dt>
				<dd>
					@Html.EditorFor(model => model.AddressPlace)</dd>
				<dd class="error">@Html.ValidationMessageFor(model => model.AddressPlace)</dd>
			</dl>
			<dl>
				<dt>
					@Html.LabelFor(model => model.Phone)</dt>
				<dd>
					@Html.EditorFor(model => model.Phone)</dd>
				<dd class="error">@Html.ValidationMessageFor(model => model.Phone)</dd>
			</dl>
			<dl>
				<dt>
					@Html.LabelFor(model => model.Mobile)</dt>
				<dd>
					@Html.EditorFor(model => model.Mobile)</dd>
				<dd class="error">@Html.ValidationMessageFor(model => model.Mobile)</dd>
			</dl>
			<dl>
				<dt>
					@Html.LabelFor(model => model.Email)</dt>
				<dd>
					@Html.EditorFor(model => model.Email)</dd>
				<dd class="error">@Html.ValidationMessageFor(model => model.Email)</dd>
			</dl>
			<dl>
				<dt>
					@Html.LabelFor(model => model.Post)</dt>
				<dd>
					@Html.EditorFor(model => model.Post)</dd>
				<dd class="error">@Html.ValidationMessageFor(model => model.Post)</dd>
			</dl>
			<dl>
				<dt>
					@Html.LabelFor(model => model.DeliveTime)</dt>
				<dd>
					@Html.EditorFor(model => model.DeliveTime)</dd>
				<dd class="error">@Html.ValidationMessageFor(model => model.DeliveTime)</dd>
			</dl>
			<p class="bu">
				<input type="submit" class="button" value="提 交" />
			</p>
		</fieldset>
 }
</div>
